/**
 * <pre>
 * Title: 		ButtonTag.java
 * Type:		com.hengpeng.common.web.tags.ButtonTag
 * Author:		linriqing
 * Create:	 	2011-7-10 下午06:00:29
 * Copyright: 	Copyright (c) 2011
 * Company:
 * <pre>
 */
package com.hengpeng.common.web.tags;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyContent;
import javax.servlet.jsp.tagext.BodyTagSupport;

import com.hengpeng.common.web.tags.vo.CommandProperty;

/**
 * <pre>
 * 页面按钮标签
 * </pre>
 * @author linriqing
 * @version 1.0, 2011-7-10
 */
public class CommandPropertyTag extends BodyTagSupport
{
	private static final long serialVersionUID = -5520116403867993858L;

	private String content;

	private int index = -1;

	private String label;

	private String tips;

	public CommandPropertyTag()
	{
		super();
	}

	public int doAfterBody() throws JspException
	{
		BodyContent body = this.getBodyContent();
		content = body.getString();
		body.clearBody();
		CommandTag parentButtonTag = (CommandTag) this.getParent();
		parentButtonTag.getPropertys().add(new CommandProperty(index, label, content, tips));
		return SKIP_BODY;
	}

	public int doEndTag() throws JspException
	{
		return super.doEndTag();
	}

	public int doStartTag() throws JspException
	{
		super.doStartTag();
		return EVAL_BODY_BUFFERED;
	}

	public String getContent()
	{
		return content;
	}

	public int getIndex()
	{
		return index;
	}

	public String getLabel()
	{
		return label;
	}

	public String getTips()
	{
		return tips;
	}

	public void setContent(String content)
	{
		this.content = content;
	}

	public void setIndex(int index)
	{
		this.index = index;
	}

	public void setLabel(String label)
	{
		this.label = label;
	}

	public void setTips(String tips)
	{
		this.tips = tips;
	}
}
